home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_08 / saks / strq3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-12  |  505 b   |  29 lines

  1. Listing 5 - non-inline member-function definitions for a type-safe queue 
  2. of str wrapped around a genq
  3.  
  4. //
  5. // strq3.cpp - a type-safe wrapper for a queue of str
  6. // wrapped around a genq
  7. //
  8.  
  9. #include "strq3.h"
  10.  
  11. void strq::clear()
  12.     {
  13.     void *p;
  14.     while (gq.remove(p))
  15.         delete (str *)p;
  16.     }
  17.  
  18. int strq::remove(str &e)
  19.     {
  20.     void *p;
  21.     int rv = gq.remove(p);
  22.     if (rv)
  23.         {
  24.         e = *(str *)p;
  25.         delete (str *)p;
  26.         }
  27.     return rv;
  28.     }
  29.